﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DFGK_WMS.Model.Models
{
    /// <summary>
    /// 收货单
    /// </summary>
    [Table("T_ReceivingBill")]
    public class ReceivingBill:BaseEntity
    {
        /// <summary>
        /// 单号
        /// </summary>
        [MaxLength(60)]
        public string BillNo { get; set; }

        public int? BillType { get; set; }
        /// <summary>
        /// 供应商Id
        /// </summary>
        public long? SupplierId { get; set; }
        /// <summary>
        /// 供应商名称
        /// </summary>
        [MaxLength(20)]
        public string SupplierName { get; set; }
        /// <summary>
        /// 生产车间代码(部门)
        /// </summary>
        [MaxLength(20)]
        public string? WorkShopCode { get; set; }
        /// <summary>
        /// 生产车间代码(部门名称)
        /// </summary>
        [MaxLength(20)]
        public string? WorkShopName {  get; set; }
        [MaxLength(50)]
        public string OtherTypeCode { get; set; }// 其他出入库类型
        /// <summary>
        /// 客户id
        /// </summary>
        public long? CustomerId { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        [MaxLength(20)]
        public string CustomerName { get; set; }

        /// <summary>
        /// 状态：0-未开始；1-未完成；2-已完成
        /// </summary>
        public int Status { get; set; }
        
        /// <summary>
        /// 库存地点
        /// </summary>
        [MaxLength(20)]
        public string StoLocation { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? BeginDate { get; set; }
        /// <summary>
        /// 完成时间
        /// </summary>
        public DateTime? EndDate { get; set; }
        /// <summary>
        /// 关联单号
        /// </summary>
        public string RefSn { get; set; }
        /// <summary>
        /// 收货人
        /// </summary>
        public string Receiver { get; set; }

        /// <summary>
        /// 总数量
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? TotalQty { get; set; }
        /// <summary>
        /// 总检查数量
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? TotalCheckQty { get; set; }
        /// <summary>
        /// 已检查数量
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal? CheckedQty { get; set; }
        /// <summary>
        /// (是否需要缠膜)是否已创建检查清单
        /// </summary>
        public bool? IsCreatedChecklist { get; set; }
        /// <summary>
        /// 检查类型
        /// </summary>
        public int? CheckType { get; set; }
        /// <summary>
        /// 检查结果
        /// </summary>
        public int? CheckResult { get; set; }
        /// <summary>
        /// 是否进行批次管理(0:否/1：是)
        /// </summary>
        public int BatchManager { get; set; }
        /// <summary>
        /// 不合格原因
        /// </summary>
        public string Ngreason { get; set; }
        /// <summary>
        /// 库房Id
        /// </summary>
        public long? WarehouseId { get; set; }
        /// <summary>
        /// 库房编码
        /// </summary>
        [MaxLength(50)]
        public string WarehouseCode { get; set; }


        /// <summary>
        /// erp入库类型
        /// </summary>
        [MaxLength(50)]
        public string POMode { get; set; }
        /// <summary>
        /// 库房名称
        /// </summary>
        [MaxLength(20)]
        public string WarehouseName { get; set; }
        [MaxLength(20)]
        public string StockCode { get; set; }
        [MaxLength(20)]
        public string StockName { get; set; }
        /// <summary>
        /// 总计
        /// </summary>
        [Column(TypeName = "decimal(18,4)")]
        public decimal TotalPrice { get; set; }   

        /// <summary>
        /// 已经收货数量
        /// </summary>
        [NotMapped]
        public decimal? ReceivedQTY { get; set; }

        /// <summary>
        /// 收货单单详情
        /// </summary>
        [NotMapped]
        public List<ReceivingBillDetail> BillDetailList
        {
            get; set;
        }=new List<ReceivingBillDetail>();
     
    }
}
